<div class="gap"></div>
<div class="gap"></div>
<div class="gap"></div>
<div class="gap"></div>

<section class="form-step1">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">Password Information</h3>
                    </div>
                    <div class="panel-body">
                        <?php
                        $form = $this->beginWidget('GxActiveForm', array(
                            'id' => 'checkPassword',
                            'enableAjaxValidation' => false,
                            'htmlOptions' => array('class' => 'form-horizontal')
                        ));
                        ?>  
                        <?php if (Yii::app()->user->hasFlash('Password')): ?>

                            <div class="flash-success errorMessage summary" style="border: 1px solid;padding: 10px;
                                 width: 64%;
                                 margin: 0 auto;">
                                 <?php echo Yii::app()->user->getFlash('Password'); ?>
                            </div>

                        <?php endif; ?>
                        <div class="gap"></div>
                        <div class="passwordYes">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">Type your Password<span class="red">*</span>: </label>
                                <div class="col-sm-3"> <input type="password" class="form-control" id="" placeholder="Password" name="password" onkeypress="return (event.keyCode != 13)"><br>
                                </div>
                            </div>
                            <div class="clearfix"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="">&nbsp; </label>                            
                                <button type="button" class="submit1" onclick="checkPassword()">Submit</button>
                                <span class="errorMessage" id="errorPassword"></span>
                            </div>

                        </div>
                        <?php
                        $this->endWidget();
                        ?>
                    </div></div></div></div></div></section>

<script>
                                    jQuery(document).ready(function() {
                                        jQuery('input:radio').change(function() {
                                            if (jQuery(this).attr('id') == 'yespassword') {
                                                jQuery(".PasswordNo").hide();
                                               jQuery("#sendMail").hide();
                                                jQuery(".passwordYes").show();

                                            } else {
                                                jQuery("#sendMail").hide();
                                                jQuery(".passwordYes").hide();
                                                jQuery(".PasswordNo").show();
                                            }
                                        });
                                    })
                                    function checkPassword() {
                                        jQuery.ajax({
                                            url: "<?php echo CController::createUrl('collegeDetails/checkPassword') ?>",
                                            type: "POST",
                                            data: jQuery("#checkPassword").serialize(),
                                            success: function(data, textStatus, jqXHR) {
                                                if (data == 1) {
                                                    window.location.href = '<?php echo CController::createUrl('collegeDetails/CollgeInfoUpdate') ?>';
                                                } else {
                                                    jQuery("#errorPassword").html(data);
                                                }
                                            },
                                        });
                                    }


</script>
